package com.geek.observer.normal;

import java.util.ArrayList;
import java.util.List;

public class ConcreteSubject implements Subject {
    private List<Observer> list = new ArrayList<>();

    @Override
    public void register(Observer observer) {
        list.add(observer);
    }

    @Override
    public void remove(Observer observer) {
        list.remove(observer);
    }

    @Override
    public void notifyObservers(Message message) {
        for (Observer observer : list) {
            observer.update(message);
        }
    }
}
